// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.IndexManagement;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexManagement.Json.QueriesConverter))]
public sealed partial class Queries
{
#if NET7_0_OR_GREATER
	public Queries()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	public Queries()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries? Cache { get; set; }
}

public readonly partial struct QueriesDescriptor
{
	internal Elastic.Clients.Elasticsearch.IndexManagement.Queries Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public QueriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Queries instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public QueriesDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(Elastic.Clients.Elasticsearch.IndexManagement.Queries instance) => new Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor Cache(Elastic.Clients.Elasticsearch.IndexManagement.CacheQueries? value)
	{
		Instance.Cache = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor Cache(System.Action<Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor> action)
	{
		Instance.Cache = Elastic.Clients.Elasticsearch.IndexManagement.CacheQueriesDescriptor.Build(action);
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.IndexManagement.Queries Build(System.Action<Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor>? action)
	{
		if (action is null)
		{
			return new Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
		}

		var builder = new Elastic.Clients.Elasticsearch.IndexManagement.QueriesDescriptor(new Elastic.Clients.Elasticsearch.IndexManagement.Queries(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}